#include "../io/xyz.h"

int main()
{
	const size_t p = 5;
	const size_t N = p*p*p;
	const Real   L = 0.5;   /* delta in nm */
	size_t       i,j,k,idx;
	
	mds_vector *atom = MDS_CALLOC_AS(mds_vector,N);
	if( !atom )
	{
		perror("allocating atoms");
		exit(-1);
	}
	
	
	idx = 0;
	for(  i=0; i < p; ++i )
	{
		const Real x_i = i * L;
		for( j=0; j < p; ++j )
		{
			const Real y_j = j * L;
			for( k=0; k < p; ++k )
			{
				mds_vector *q =  &atom[ idx++ ];
				q->x = x_i;
				q->y = y_j;
				q->z = k * L;
			}
		}
		
	}
	
	if( mds_xyz_save( "cube.xyz", atom, N, "first frame", 0) < 0 )
	{
		perror( "couldn't save!");
		exit(-1);
	}
	
	
	MDS_FREE_AS(mds_vector,atom,N);
	
	return 0;
}

